package com.neo.web;


import com.neo.model.DevJob;
import com.neo.service.DevJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "定时任务")
@RestController
public class DevJobController {

    @Autowired
    DevJobService devJobService;


    /**
     * 添加定时任务
     *
     */
    @ApiOperation("添加定时任务")
    @PostMapping("/dev/job/add")
    public Boolean add(@RequestBody @Valid DevJob devJob) {
        return devJobService.add(devJob);
    }


    /**
     * 获取定时任务列表
     */
    @ApiOperation("获取定时任务列表")
    @GetMapping("/dev/job/list")
    public List<DevJob> list(DevJob devJob) {
        return devJobService.getlist(devJob);
    }


    /**
     * 获取定时任务类
     *
     */
    @ApiOperation("获取定时任务类")
    @GetMapping("/dev/job/getActionClass")
    public List<String> getActionClass() {
        return devJobService.getActionClass();
    }
}

